#!/usr/bin/python3
class Student:
    def __init__(self,name,age,gender):
        self.name = name
        self.age = age
        self.gender = gender
    def __eq__(self, other):
        # 1判断类型是否是Student类   (类的内部可以用__这样的变量)
        if isinstance(other,Student):
            # 2类型正确，判断对象的数据
            if self.name == other.name and self.age ==other.age and self.gender ==other.gender:
                return True
            else:
                return False
        else:
            return False

    def introduce(self):
            print(f'大家好，我叫{self.name},今年{self.age}了,{self.gender}')
    def __str__(self):
        # 将当前对象数据返回
        return f'Student[name={self.name},age={self.age},gender={self.gender}]'


if __name__ == '__main__':
        student1 = Student("张三", 18, "男")
        student1.introduce()

        student2 = Student("小美", 18, '男')
        student2.introduce()
        result= student1 ==student2
        print(f'resunlt={result}')